<?php
/* 
 * Copyright (c) 2018-2023   All rights reserved.
 *
 * 创建时间：2023-02-19 14:16:38
 *
 * 项目：/levmodules  -  $  - BaseUserFormModel.php
 *
 * 作者：{{AUTO GENERATE}}
 */

//此文件使用程序自动生成，下次生成时会覆盖，不建议修改。

namespace modules\levmodules\table\form\Form_lev_modules\_gen;

use Lev;
use lev\base\Modelv;
use lev\base\SubModelv;

!defined('INLEV') && exit('Access Denied LEV');


class BaseForm_lev_modules extends SubModelv
{

    public static $tableName = '{{%lev_modules}}';

    public static function safeColumnsGen($columns)
    {
        $allColumns = static::allColumns();
        if (is_array($allColumns)) {
            foreach ($columns as $field => $value) {
                if (!isset($allColumns[$field])) unset($columns[$field]);
            }
        }
        return parent::safeColumnsGen($columns); // TODO: Change the autogenerated stub
    }

    public static function allColumns() {
        return array(
                'id'           => 'Id',

                'typeid'       => '分类',

                'name'         => '模块名称',

                'identifier'   => '唯一标识',

                'classdir'     => 'Classdir',

                'descs'        => '简短描述',

                'copyright'    => '版权',

                'version'      => '版本号',

                'versiontime'  => '版本时间号',

                'settings'     => '通用设置',

                'displayorder' => '排序',

                'status'       => '状态',

                'uptime'       => '更新时间',

                'addtime'      => '添加时间',

        );
    }

    public static function inputs($iden = '', $keyfield = '', $classify = null)
    {
        //return parent::inputs($iden, $keyfield, $classify); // TODO: Change the autogenerated stub
        return array(
                'classdir'                 => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '父模块标识',
                    'placeholder'      => '仅允许一级子模块（即：子模块不允许再有子模块）',
                    'inputname'        => 'classdir',
                    'inputtype'        => 'selectcode',
                    'inputvalue'       => '',
                    'settings'         => 'modules\\levmodules\\levmodulesHelper',
                    'displayorder'     => '1',
                    'status'           => '1',
            ),

                'name'                     => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '模块名称',
                    'placeholder'      => '自动添加到网站关建词尾部，用于SEO优化',
                    'inputname'        => 'name',
                    'inputtype'        => 'text',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '2',
                    'status'           => '1',
            ),

                'identifier'               => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '唯一标识',
                    'placeholder'      => '自动添加到网站关建词尾部，用于SEO优化',
                    'inputname'        => 'identifier',
                    'inputtype'        => 'text',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '3',
                    'status'           => '1',
            ),

                'descs'                    => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '简短描述',
                    'placeholder'      => '简单概括模块的功能<br>自动添加到网站描述尾部，用于SEO优化',
                    'inputname'        => 'descs',
                    'inputtype'        => 'text',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '4',
                    'status'           => '1',
            ),

                'copyright'                => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '版权',
                    'placeholder'      => '留空自动填写版权：Lev',
                    'inputname'        => 'copyright',
                    'inputtype'        => 'text',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '5',
                    'status'           => '1',
            ),

                'version'                  => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '版本号',
                    'placeholder'      => '留空自动生成Ymd.01版本号，它应该是有规律的
只允许字母、数字、中划线和下划线',
                    'inputname'        => 'version',
                    'inputtype'        => 'text',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '6',
                    'status'           => '1',
            ),

                'settings___adminClassify' => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '设置分类导航',
                    'placeholder'      => '设置项分类，或者是表单分类',
                    'inputname'        => 'settings___adminClassify',
                    'inputtype'        => 'navs',
                    'inputvalue'       => '',
                    'settings'         => 'order=排序===60
status=开关
name=设置分类名称===160
descs=备注描述',
                    'displayorder'     => '7',
                    'status'           => '1',
            ),

                'settings___price'         => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '模块价格(元)',
                    'placeholder'      => '模块商城售价，成功上架可以出售给其它站长使用',
                    'inputname'        => 'settings___price',
                    'inputtype'        => 'number',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '0',
                    'status'           => '3',
            ),

                'settings___upprice'       => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '模块升级价格(元)',
                    'placeholder'      => '每次从商城升级模块需要支付的费用
不支付不能升级',
                    'inputname'        => 'settings___upprice',
                    'inputtype'        => 'text',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '2',
                    'status'           => '3',
            ),

                'settings___adminNavs'     => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '管理导航',
                    'placeholder'      => '可以自动创建控制器文件',
                    'inputname'        => 'settings___adminNavs',
                    'inputtype'        => 'tablesForm',
                    'inputvalue'       => '',
                    'settings'         => array(
                        'tablesForm' => array(
                            '8'  => array(
                                'id'          => 8,
                                'order'       => '1',
                                'title'       => 'ID',
                                'inputname'   => 'id',
                                'inputtype'   => 'number',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '1'  => array(
                                'id'          => 1,
                                'order'       => '2',
                                'title'       => '排序',
                                'inputname'   => 'order',
                                'inputtype'   => 'number',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '2'  => array(
                                'id'          => 2,
                                'order'       => '3',
                                'title'       => '导航名称',
                                'inputname'   => 'name',
                                'inputtype'   => 'text',
                                'width'       => '100',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '4'  => array(
                                'id'          => 4,
                                'order'       => '4',
                                'title'       => '打开方式',
                                'inputname'   => 'target',
                                'inputtype'   => 'selectcode',
                                'width'       => '100',
                                'settings'    => 'lev\\helpers\\SettingsHelper',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '5'  => array(
                                'id'          => 5,
                                'order'       => '5',
                                'title'       => '开关',
                                'inputname'   => 'status',
                                'inputtype'   => 'radio',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '6'  => array(
                                'id'          => 6,
                                'order'       => '6',
                                'title'       => '数据表',
                                'inputname'   => 'tableName',
                                'inputtype'   => 'selectSearch',
                                'width'       => '120',
                                'settings'    => 'modules\\levmodules\\helpers\\levmodulesSetHelper',
                                'placeholder' => '设置后将自动创建列表控制器文件',
                                'inputvalue'  => '',
                        ),
                            '10' => array(
                                'id'          => 10,
                                'order'       => '10',
                                'title'       => '控制器类型',
                                'inputname'   => 'ctype',
                                'inputtype'   => 'selectcode',
                                'width'       => '100',
                                'settings'    => 'modules\\levmodules\\helpers\\levmodulesColumnsHelper',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '7'  => array(
                                'id'          => 7,
                                'order'       => '71',
                                'title'       => '链接地址或路由名称&99z;例：admin-user&00z;',
                                'inputname'   => 'link',
                                'inputtype'   => 'text',
                                'width'       => '',
                                'settings'    => '',
                                'placeholder' => '使用Lev::toReRoute&99z;[link,identifier]&00z;解析此地址',
                                'inputvalue'  => '',
                        ),
                            '9'  => array(
                                'id'          => 9,
                                'order'       => '91',
                                'title'       => '强制',
                                'inputname'   => 'forceGen',
                                'inputtype'   => 'radio',
                                'width'       => '50',
                                'settings'    => '',
                                'placeholder' => '强制重新生成控制器文件',
                                'inputvalue'  => '',
                        ),
                    ),
                ),
                    'displayorder'     => '8',
                    'status'           => '4',
            ),

                'settings___pageNavs'      => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '前台展示页面',
                    'placeholder'      => '自动创建控制器等基础框架文件',
                    'inputname'        => 'settings___pageNavs',
                    'inputtype'        => 'tablesForm',
                    'inputvalue'       => '',
                    'settings'         => array(
                        'tablesForm' => array(
                            '1' => array(
                                'id'          => 1,
                                'order'       => '1',
                                'title'       => 'ID',
                                'inputname'   => 'id',
                                'inputtype'   => 'number',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '2' => array(
                                'id'          => 2,
                                'order'       => '2',
                                'title'       => '排序',
                                'inputname'   => 'order',
                                'inputtype'   => 'number',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '3' => array(
                                'id'          => 3,
                                'order'       => '3',
                                'title'       => '开关',
                                'inputname'   => 'status',
                                'inputtype'   => 'radio',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '4' => array(
                                'id'          => 4,
                                'order'       => '4',
                                'title'       => '导航名称',
                                'inputname'   => 'name',
                                'inputtype'   => 'text',
                                'width'       => '100',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '5' => array(
                                'id'          => 5,
                                'order'       => '5',
                                'title'       => '路由名称&99z;例：zst-xt&00z;',
                                'inputname'   => 'link',
                                'inputtype'   => 'text',
                                'width'       => '200',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '6' => array(
                                'id'          => 6,
                                'order'       => '6',
                                'title'       => '强制',
                                'inputname'   => 'forceGen',
                                'inputtype'   => 'radio',
                                'width'       => '50',
                                'settings'    => '',
                                'placeholder' => '强制重新生成文件，它将覆盖原来生成的所有文件',
                                'inputvalue'  => '1',
                        ),
                            '7' => array(
                                'id'          => 7,
                                'order'       => '7',
                                'title'       => '生成',
                                'inputname'   => 'gen',
                                'inputtype'   => 'radio',
                                'width'       => '50',
                                'settings'    => '',
                                'placeholder' => '是否自动生成的页面
主要用于识别是否为生成型导航，若要生成文件需要同时开启强制生成',
                                'inputvalue'  => '1',
                        ),
                            '8' => array(
                                'id'          => 8,
                                'order'       => '8',
                                'title'       => '备注',
                                'inputname'   => 'descs',
                                'inputtype'   => 'text',
                                'width'       => '',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                    ),
                ),
                    'displayorder'     => '110',
                    'status'           => '6',
            ),

                'settings___forms'         => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '模块表单',
                    'placeholder'      => '可以自动创建表单模型及控制器文件；<tips>建议使用【表单分步】</tips>每个分步都相当于一个新表单且不会生成新的文件',
                    'inputname'        => 'settings___forms',
                    'inputtype'        => 'tablesForm',
                    'inputvalue'       => '',
                    'settings'         => array(
                        'tablesForm' => array(
                            '8' => array(
                                'id'          => 8,
                                'order'       => '0',
                                'title'       => 'ID',
                                'inputname'   => 'id',
                                'inputtype'   => 'number',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '1' => array(
                                'id'          => 1,
                                'order'       => '1',
                                'title'       => '排序',
                                'inputname'   => 'order',
                                'inputtype'   => 'number',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '2' => array(
                                'id'          => 2,
                                'order'       => '2',
                                'title'       => '开关',
                                'inputname'   => 'status',
                                'inputtype'   => 'radio',
                                'width'       => '40',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                            '4' => array(
                                'id'          => 4,
                                'order'       => '4',
                                'title'       => '数据表',
                                'inputname'   => 'tableName',
                                'inputtype'   => 'selectSearch',
                                'width'       => '100',
                                'settings'    => 'modules\\levmodules\\helpers\\levmodulesSetHelper',
                                'placeholder' => '不设置数据表，会导致无法存储表单数据',
                                'inputvalue'  => '',
                        ),
                            '5' => array(
                                'id'          => 5,
                                'order'       => '5',
                                'title'       => '表单元素',
                                'inputname'   => 'formInputs',
                                'inputtype'   => 'selectSearch',
                                'width'       => '100',
                                'settings'    => 'modules\\levmodules\\helpers\\levmodulesSetHelper',
                                'placeholder' => '表单包含的输入框，在设置分类中提取',
                                'inputvalue'  => '',
                        ),
                            '3' => array(
                                'id'          => 3,
                                'order'       => '7',
                                'title'       => '表单名称',
                                'inputname'   => 'formName',
                                'inputtype'   => 'text',
                                'width'       => '100',
                                'settings'    => '',
                                'placeholder' => '只允许a-z、0-9和下划线必须以字母开头
留空将自动使用表单元素名称',
                                'inputvalue'  => '',
                        ),
                            '9' => array(
                                'id'          => 9,
                                'order'       => '9',
                                'title'       => '强制生成',
                                'inputname'   => 'forceGen',
                                'inputtype'   => 'radio',
                                'width'       => '60',
                                'settings'    => '',
                                'placeholder' => '强制创建表单模型、控制器等文件，文件内标注不覆盖的除外。',
                                'inputvalue'  => '',
                        ),
                            '6' => array(
                                'id'          => 6,
                                'order'       => '61',
                                'title'       => '表单备注标题',
                                'inputname'   => 'title',
                                'inputtype'   => 'text',
                                'width'       => '',
                                'settings'    => '',
                                'placeholder' => '',
                                'inputvalue'  => '',
                        ),
                    ),
                ),
                    'displayorder'     => '10',
                    'status'           => '7',
            ),

                'settings___dzinstall'     => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => '生成DISCUZ插件相关安装文件',
                    'placeholder'      => '开启后，将自动生成DISCUZ插件相关安装文件。可以在DZ后台插件管理处安装。
文件包括：discuz_plugin_{{iden}}.xml、install.php、uninstall.php、upgrade.php',
                    'inputname'        => 'settings___dzinstall',
                    'inputtype'        => 'radio',
                    'inputvalue'       => '1',
                    'settings'         => '',
                    'displayorder'     => '19',
                    'status'           => '11',
            ),

                'settings___navTitle'      => array(
                    'moduleidentifier' => 'levmodules',
                    'classify'         => 'lev_modules',
                    'title'            => ' DZ论坛主导航名称',
                    'placeholder'      => '主要用于设置dz的XML安装文件，仅对创建文件时修改XML导航名称',
                    'inputname'        => 'settings___navTitle',
                    'inputtype'        => 'text',
                    'inputvalue'       => '',
                    'settings'         => '',
                    'displayorder'     => '20',
                    'status'           => '11',
            ),

        );
    }

    public static function setupDesc()
    {
        //return parent::setupDesc(); // TODO: Change the autogenerated stub
        return array(
                '1'  => '第1步',

                '3'  => '第3步',

                '4'  => '第4步',

                '6'  => '第6步',

                '7'  => '第7步',

                '11' => '第11步',

        );
    }

    public static function getNextSetup()
    {
        return parent::getNextSetup(); // TODO: Change the autogenerated stub
    }

    public static function inputsSetup()
    {
        return parent::inputsSetup(); // TODO: Change the autogenerated stub
    }

    /**
     * 额外的表单字段，不会存入数据库
     * @return array inputs
     */
    public static function extInputs() {
        return [];
    }

    //eg: <div class="card card-header"></div>
    /**
     * 表单头部htm
     * @return string
     */
    public static function headerHtm() {
        return !Lev::isDeveloper(Lev::$app['iden']) ? '' :
            '<tips class="gray inblk scale8">自定义headerHtm：文件位置：'.__DIR__ . '/Form_lev_modules.php'.'</tips>';
    }

    /**
     * 表单底部htm
     * <tips class="gray inblk scale8">自定义footerHtm</tips>
     * @return string
     */
    public static function footerHtm() {
        return '';
    }

    /**
     * 表单底部内部htm
     * <tips class="gray inblk scale8">自定义footerFormInnerHtm</tips>
     * @return string
     */
    public static function footerFormInnerHtm() {
        return '';
    }

}